package com.yue.pattern.singleton;

/**
 * 饿汉单例
 */
public class Hungry {

    //类加载顺序：先静态，后动态
    //先属性，后方法
    //先上 后下
    private Hungry() {
    }

    private static final Hungry hungry = new Hungry();

    public static Hungry getInstance() throws InterruptedException {
        Thread.sleep(100);
        System.out.println(System.currentTimeMillis() + ":" + hungry);
        return hungry;
    }
}
